import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';

@Entity('semester')
export class Semester {
    @PrimaryGeneratedColumn()
    semester_id: number;

    @Column({ name: 'name', type: 'varchar', length: 50 })
    name: string;

    @Column({ 
        name: 'start_date', 
        type: 'date',
        default: () => 'CURRENT_DATE' // 添加默认值
    })
    startDate: Date;

    @Column({ 
        name: 'end_date', 
        type: 'date',
        default: () => 'CURRENT_DATE' // 添加默认值
    })
    end_date: Date;

    @Column({ 
        name: 'status', 
        type: 'enum', 
        enum: ['planned', 'current', 'completed'],
        default: 'current'
    })
    status: string;
}